import {adminUrl} from "@/utils/baseUrl.js"
import request from '@/utils/request'

// 创建入住记录
export function createAccommodationReside(data) {
  return request({
    url: adminUrl + '/collegebase/accommodation-reside/create',
    method: 'post',
    data: data
  })
}

// 更新入住记录
export function updateAccommodationReside(data) {
  return request({
    url: adminUrl + '/collegebase/accommodation-reside/update',
    method: 'put',
    data: data
  })
}

// 删除入住记录
export function deleteAccommodationReside(id) {
  return request({
    url: adminUrl + '/collegebase/accommodation-reside/delete?id=' + id,
    method: 'delete'
  })
}

// 获得入住记录
export function getAccommodationReside(id) {
  return request({
    url: adminUrl + '/collegebase/accommodation-reside/get?id=' + id,
    method: 'get'
  })
}

// 获得入住记录分页
export function getAccommodationResidePage(query) {
  return request({
    url: adminUrl + '/collegebase/accommodation-reside/page',
    method: 'get',
    params: query
  })
}
//根据房间id获得铺位
export function byRoomList(roomId) {
  return request({
    url: adminUrl + '/collegebase/accommodation-bed/byRoom/list',
    method: 'get',
    params: {
      roomId
    }
  })
}
//根据系部id获取房间列表
export function byDepartmentList(departmentId) {
  return request({
    url: adminUrl + '/collegebase/accommodation-room/byDepartment/list',
    method: 'get',
    params: {
      departmentId
    }
  })
}
//迁出
export function moveOut(data) {
  return request({
    url: adminUrl + '/collegebase/accommodation-reside/update/status',
    method: 'put',
    params:{
      id:data.id
    }
  })
}
//迁入/admin-api
export function moveIn(data) {
  return request({
    url: adminUrl + '/collegebase/accommodation-reside/add',
    method: 'post',
    data
  })
}
// 导出入住记录 Excel
export function exportAccommodationResideExcel(query) {
  return request({
    url: adminUrl + '/collegebase/accommodation-reside/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
